package com.heiyanqiang.dao;

import com.heiyanqiang.domain.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProductDao {

    //根据id查询产品
    @Select("select * from product where id=#{id}")
    Product fidById(Integer id) throws Exception;


    @Select("select * from product")
    List<Product> findAll() throws Exception;


    //@Insert("insert into product (`id`, `productNum`, `productName`, `cityName`, `departureTime`, `productPrice`, `productDesc`, `productStatus`) " +"values(productNum=#{productNum}, productName=#{productName},cityName=#{cityName},departureTime=#{departureTime},productPrice=#{productPrice},productDesc=#{productDesc},productStatus=#{productStatus})")

    @Insert("insert into product (`productNum`, `productName`, `cityName`, `departureTime`, `productPrice`, `productDesc`, `productStatus`) VALUES (#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    void save(Product product) throws Exception;
}
